﻿using Maticsoft.BLL;
using Maticsoft.DBUtility;

using System;
using System.Data;
using System.Text;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Wuqi.Webdiyer;

public partial class WebPage_DiaoCha_Fankui : SystemBBasePage
{
    private string sql = "";
    private int text = Convert.ToInt32(PageIndex.pageIndex);
    private vote_question voqt = new vote_question();

    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        this.fanKui();
    }

    private void fanKui()
    {
        StringBuilder builder = new StringBuilder();
        builder.Append("<tr >");
        builder.Append("<th width='40'>ID</th>");
        builder.Append("<th width='400'>标题</th>");
        builder.Append("<th width='150'>反馈(人次)</th>");
        builder.Append("<th width='100'>状态</th>");
        builder.Append("<th width='100'>排序</th>");
        builder.Append("<th width='60'>操作</th>");
        builder.Append("</tr>");
        vote_feedback_question _question = new vote_feedback_question();
        StringBuilder builder2 = new StringBuilder();
        Pagers pagers = DbHelperSQL.SelectByPager("*", this.sql, "Id desc", this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize, "vote_question", "", "");
        if ((pagers != null) && (pagers.MyData.Rows.Count > 0))
        {
            this.AspNetPager1.RecordCount = pagers.TotalRecords;
            for (int i = 0; i < pagers.MyData.Rows.Count; i++)
            {
                DataRow row = pagers.MyData.Rows[i];
                if ((i % 2) != 0)
                {
                    builder.Append("<tr>");
                }
                else
                {
                    builder.Append("<tr class='alt'>");
                }
                builder.Append("<td>" + row["id"] + "</td>");
                builder.Append("<td>" + row["Title"] + "</td>");
                if (_question.GetModelList("question_id=" + row["id"].ToString()).Count >= 0)
                {
                    builder.Append("<td>" + _question.GetModelList("question_id=" + row["id"].ToString()).Count + "(人次)</td>");
                }
                else
                {
                    builder.Append("<td>0(人次)</td>");
                }
                if (Convert.ToInt32(row["is_show"].ToString()) == 1)
                {
                    builder.Append("<td>显示</td>");
                }
                else
                {
                    builder.Append("<td>隐藏</td>");
                }
                builder.Append("<td>" + row["order"] + "</td>");
                builder.Append(string.Concat(new object[] { "<td><a href='Diaocha_Fankui_Xiangqing.aspx?xiangqing=", row["id"], "&title=", row["Title"], "'>详情</a></td>" }));
                builder.Append("</tr>");
            }
        }
        this.Literal1.Text = builder.ToString();
        this.Literal2.Text = builder2.ToString();
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        this.HeaderControl1.Select = "diaocha";
        this.DiaoCha1.Select = "Fankui";
        this.sql = "is_show=1";
        if (!base.IsPostBack)
        {
            this.fanKui();
        }
    }
}


